﻿
namespace Jet.Utilities.Serialization
{
	/// <summary>
	/// Simple serialization/deserrialization into memory
	/// </summary>
	public interface ISerializationService
	{
		/// <summary>
		/// Serialize object graph to byte array
		/// </summary>
		/// <param name="obj">Object to serialize</param>
		/// <param name="maxSize">Maximum array size</param>
		byte[] SerializeObject(object obj, int maxSize = 1024);

		/// <summary>
		/// Deserialize object graph from byte array
		/// </summary>
		/// <typeparam name="TObject">Type of deserialized object</typeparam>
		/// <param name="buffer">Array with serialization data</param>
		TObject DeserializeObject<TObject>(byte[] buffer);
	}
}
